-
Notifications
You must be signed in to change notification settings - Fork 267
chore(tests): Add in app messaging testing infrastructure and tests #1615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
a69c00c to
f828623
Compare
1dee76e to
be40d3d
Compare
|
Failing tests: |
| - (void)overrideWebViewContentFinishedLoading:(OSInAppMessageInternal *)message { | ||
| if (message) { | ||
| [OSMessagingController.sharedInstance messageViewImpressionRequest:message]; | ||
| // [OSMessagingController.sharedInstance messageViewImpressionRequest:message]; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method does nothing now, can we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was testing something, didn't mean to commit this one change, I'll undo it.
| /// ✅ Migrated to `testPausingIAMs_doesNotCreateMessageQueue`... This test statement below is no longer true as of `5.2.9`. | ||
| // - (void)testDisablingIAMs_stillCreatesMessageQueue_butPreventsMessageDisplay { | ||
| // let message = [OSInAppMessageTestHelper testMessageJsonWithTriggerPropertyName:OS_DYNAMIC_TRIGGER_KIND_SESSION_TIME withId:@"test_id1" withOperator:OSTriggerOperatorTypeLessThan withValue:@10.0]; | ||
| // let registrationResponse = [OSInAppMessageTestHelper testRegistrationJsonWithMessages:@[message]]; | ||
|
|
||
| // // this should prevent message from being shown | ||
| // [OneSignal pauseInAppMessages:true]; | ||
|
|
||
| // // the trigger should immediately evaluate to true and should | ||
| // // be shown once the SDK is fully initialized. | ||
| // [OneSignalClientOverrider setMockResponseForRequest:NSStringFromClass([OSRequestRegisterUser class]) withResponse:registrationResponse]; | ||
|
|
||
| // [UnitTestCommonMethods initOneSignal_andThreadWait]; | ||
|
|
||
| // // Make sure no IAM is showing, but the queue has any IAMs | ||
| // XCTAssertFalse(OSMessagingControllerOverrider.isInAppMessageShowing); | ||
| // XCTAssertEqual(OSMessagingControllerOverrider.messageDisplayQueue.count, 1); | ||
| // } | ||
|
|
||
| /// ✅ Migrated to `testPreviewIAMIsDisplayedOnPause` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this code if it as been migrated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that makes sense
12491ad to
19374af
Compare
Add Swift `IAMIntegrationTests` test file and check for accessibility of `OSMessagingController` from the test file
* no longer used, dead code
* Aren't called by anything so no need to be on the interface, these are called by the class itself.
* Without a description, the object will return something like `<OSRequestGetInAppMessages: 0x600001798bc0>`. By adding a predictable description, we can operate on the object.
* Re-usable test helpers and mock functionality * Include own swiftlint file * ❗️ After `OneSignalInAppMessagesMocks` was created, I had to then manually "convert to group" or else the CI had build errors about the following: xcodebuild: error: Unable to read project 'OneSignal.xcodeproj' Reason: The project ‘OneSignal’ is damaged and cannot be opened. Examine the project file for invalid edits or unresolved source control conflicts. Exception: didn't find classname for 'isa' key
…alInAppMessages * This extension on `UIApplication` is only used in the `OneSignalInAppMessages` framework, so there is no need to keep it in the umbrella `OneSignalFramework` framework, which causes errors if only `OneSignalInAppMessages` is tested (without also importing OneSignalFramework).
* Has helper methods for repeating functionality
* Attempt to migrate `testDisablingIAMs_stillCreatesMessageQueue_butPreventsMessageDisplay` to new tests, but behavior has changed. It becomes `testPausingIAMs_doesNotCreateMessageQueue` * Migrate `testPreviewIAMIsDisplayedOnPause`
* `messageViewImpressionRequest` was removed from the `OSMessagingController` header file, so update `OSMessagingControllerOverrider` to expose it for internal usage. * Delete old tests that have been migrated
19374af to
2267465
Compare
Description
One Line Summary
Add basic infrastructure to test the
OneSignalInAppMessagesmodule, and begin migrating tests.Details
OneSignalInAppMessagesusing Swift language, primarily.Motivation
Increase tests, porting over tests.
Scope
Testing only, not changing the shipped SDK, or making any internal APIs public.
Testing
Unit testing
IAMIntegrationTestsand migrate 2 integration teststestDisablingIAMs_stillCreatesMessageQueue_butPreventsMessageDisplayto new tests, but behavior has changed. It becomestestPausingIAMs_doesNotCreateMessageQueue.OneSignalInAppMessagesMocksfor re-usable test helpers and mock functionalityConsistencyManagerTestHelperswith methods for repeating functionalityManual testing
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is